public void grantBy(SystemAdmin admin)
        {
            if (!state.Equals(CLAIMED) && !state.Equals(UNIX_CLAIMED))
            {
                return;
            }
            if (!this.admin.Equals(admin))
            {
                return;
            }

            if (profile.IsUnixPermissionRequired() && state.Equals(UNIX_CLAIMED))
            {
                isUnixPermissionGranted = true;
            }
            else if (profile.IsUnixPermissionRequired() && !IsUnixPermissionGranted())
            {
                state = UNIX_REQUESTED;
                notifyAdminOfPermissionRequest();
                return;
            }
            state     = GRANTED;
            isGranted = true;
            notifyAdminOfPermissionRequest();
        }
Beispiel #2
0
        public void GrantedBy(SystemAdmin admin)
        {
            #region original process logic
            //if (!state.Equals(CLAIMED))
            //    return;
            //if (!this.admin.Equals(admin))
            //    return;
            //state = GRANTED;
            //granted = true;
            //notifyUserOfPermissionRequestResult();
            #endregion

            // 添加 UNIX 权限相关逻辑
            if (!_state.Equals(CLAIMED) && !_state.Equals(UNIX_CLAIMED))
            {
                return;
            }

            if (!_admin.Equals(admin))
            {
                return;
            }

            if (_profile.IsUnixPermissionRequired() && _state.Equals(UNIX_CLAIMED))
            {
                _unixPermissionGranted = true;
            }
            else if (_profile.IsUnixPermissionRequired() && !IsUnixPermissionGranted())
            {
                _state = UNIX_REQUESTED;
                NotifyUnixAdminsOfPermissionRequest();
                return;
            }
            _state   = GRANTED;
            _granted = true;
            NotifyUserOfPermissionRequestResult();
        }
Beispiel #3
0
        //public static readonly string REQUESTED = "REQUESTED";
        //public static readonly string CLAIMED = "CLAIMED";
        //public static readonly string GRANTED = "GRANTED";
        //public static readonly string DENIED = "DENIED";
        //// UNIX 权限相关的状态值
        //public static readonly string UNIX_REQUESTED = "UNIX_REQUESTED";
        //public static readonly string UNIX_CLAIMED = "UNIX_CLAIMED";

        public SystemPermission(SystemUser requestor, SystemProfile profile)
        {
            Admin      = new SystemAdmin();
            _requestor = requestor;
            Profile    = profile;
            if (profile.IsUnixPermissionRequired())
            {
                State = PermissionState.UNIX_REQUESTED;
            }
            else
            {
                State = PermissionState.REQUESTED;
            }
            Granted = false;
            notifyAdminOfPermissionRequest();
        }
Beispiel #4
0
 public SystemPermission(SystemUser requestor, SystemProfile profile)
 {
     _admin     = new SystemAdmin();
     _requestor = requestor;
     _profile   = profile;
     if (profile.IsUnixPermissionRequired())
     {
         _state = UNIX_REQUESTED;
     }
     else
     {
         _state = REQUESTED;
     }
     _granted = false;
     notifyAdminOfPermissionRequest();
 }
Beispiel #5
0
 public bool isUnixPermissionDesiredButNotRequested()
 {
     return(profile.IsUnixPermissionRequired() && !IsUnixPermissionGranted);
 }