Example #1
0
    def make_self_acl(self, perm):
        """Constucts acl for the current user.

        If the user is root, use host principal.
        """
        if utils.is_root():
            return self.make_host_acl(sysinfo.hostname(), perm)

        user = krb5.get_principal()
        return self.make_user_acl(user, perm)
Example #2
0
def make_self_acl(perm):
    """Constucts acl for the current user.

    If the user is root, use host principal.
    """
    assert _is_valid_perm(perm)
    if utils.is_root():
        return make_host_acl(sysinfo.hostname(), perm)

    user = utils.get_current_username()
    return make_user_acl(user, perm)