Create a Permissions class
See original GitHub issueTo make #1156 less of a mess, create a Permissions
class to allow for
- Type safety - can be parsed from a
String
instead of anint
to avoid octal vs. decimal confusion - Compactness - internal representation can still be an
int
- Ease of use - relevant methods on this class instead of using a helper and doing multiple back-and-forth conversions
- Extendability - should be easy to add operations if/as we need them
Right now we only really need two methods:
/* Parse/validate an octal String (e.g. "755"). */
static Permissions fromString(String octalString);
/* Set the permissions on a TarArchiveEntry. */
void setOnTarArchiveEntry(TarArchiveEntry entry);
but we can decide to add stuff depending on how people want to use the library.
static Permissions fromSet(Set<PosixFilePermission> octalString);
Permissions addPermission(PosixFilePermission permission);
Set<PosixFilePermission> getPermissionSet();
int getPermissionBits();
// etc.
Issue Analytics
- State:
- Created 5 years ago
- Reactions:1
- Comments:5 (5 by maintainers)
Top Results From Across the Web
Custom Permission Classes in Django REST Framework
This article looks at how to build custom permission classes in Django REST Framework (DRF).
Read more >Permissions - Django REST framework
The DRY Rest Permissions package provides the ability to define different permissions for individual default and custom actions. This package is made for...
Read more >Custom Permissions in Django Rest - DEV Community
When building a web API using DRF, you are directly provided some permissions classes such as AllowAny or IsAuthenticated for example.
Read more >Create custom permission classes - django - Stack Overflow
Create a custom permission class that subclasses rest_framework.permissions.BasePermission; override has_object_permission() method; Inside the ...
Read more >Custom Permission Classes in Django Rest Framework
Custom Permission Classes in Django Rest Framework · IsAuthenticated : This class mainly checks if the user has been authenticated or not and...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Yea, this class will be user-facing, so
getPermissionBits
sounds good instead of requiringTarArchiveEntry
.That’s true. I don’t think this class is going to be exclusively for internal usage. It might be worth it to just leave out
applyToTarArchiveEntryMode
and usegetPermissionBits
.Alternatively, we could make it
applyToFileMode
which would take anint
and return anint
with the lowest 9 bits set.