5
0
mirror of git://git.proxmox.com/git/pxar.git synced 2024-12-22 21:33:50 +03:00

acl: User/Group::new method

with some convenience to not require the Permissions type
wraparound.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
This commit is contained in:
Wolfgang Bumiller 2020-06-26 13:05:04 +02:00
parent b4d3fe517f
commit 4c3318a28e

View File

@ -28,6 +28,15 @@ pub struct User {
//pub name: Vec<u64>, not impl for now //pub name: Vec<u64>, not impl for now
} }
impl User {
pub fn new(uid: u64, permissions: u64) -> Self {
Self {
uid,
permissions: Permissions(permissions),
}
}
}
// TODO if also name is impl, sort by uid, then by name and last by permissions // TODO if also name is impl, sort by uid, then by name and last by permissions
impl Ord for User { impl Ord for User {
fn cmp(&self, other: &User) -> Ordering { fn cmp(&self, other: &User) -> Ordering {
@ -54,6 +63,15 @@ pub struct Group {
//pub name: Vec<u64>, not impl for now //pub name: Vec<u64>, not impl for now
} }
impl Group {
pub fn new(gid: u64, permissions: u64) -> Self {
Self {
gid,
permissions: Permissions(permissions),
}
}
}
// TODO if also name is impl, sort by gid, then by name and last by permissions // TODO if also name is impl, sort by gid, then by name and last by permissions
impl Ord for Group { impl Ord for Group {
fn cmp(&self, other: &Group) -> Ordering { fn cmp(&self, other: &Group) -> Ordering {