def _run(self, args): avatar = AvatarHolder().getById(args.id) self.printUserInfo(avatar, args.id) if avatar.isAdmin(): print "User seems to already has administrator privileges" if console.yesno("Are you sure to grant administrator privileges to this user?"): adminList = info.HelperMaKaCInfo.getMaKaCInfoInstance().getAdminList() adminList.grant(avatar) avatar.activateAccount() print "Administrator privileges granted successfully" return 0
def _run(self, args): avatar = AvatarHolder().getById(args.id) self.printUserInfo(avatar, args.id) if avatar.isAdmin(): print "User seems to already has administrator privileges" if console.yesno( "Are you sure to grant administrator privileges to this user?" ): adminList = info.HelperMaKaCInfo.getMaKaCInfoInstance( ).getAdminList() adminList.grant(avatar) avatar.activateAccount() print "Administrator privileges granted successfully" return 0
def user_grant(user_id): """Grants administration rights to a given user""" avatar = AvatarHolder().getById(user_id) if avatar is None: error("The user does not exists") return print_user_info(avatar) if avatar.isAdmin(): warning("This user already has administration rights") return if prompt_bool(cformat("%{yellow}Grant administration rights to this user?")): admin_list = HelperMaKaCInfo.getMaKaCInfoInstance().getAdminList() admin_list.grant(avatar) avatar.activateAccount() success("Administration rights granted successfully")
def _process(self): av = AvatarHolder().getById(self._userId) if av.isActivated(): p = signIn.WPAccountAlreadyActivated(self, av) return p.display() # return "your account is already activated" if av.isDisabled(): p = signIn.WPAccountDisabled(self, av) return p.display() # return "your account is disabled. please, ask to enable it" elif self._key == av.getKey(): av.activateAccount() p = signIn.WPAccountActivated(self, av) return p.display() # return "Your account is activate now" else: return "Wrong key. Please, ask for a new one" pass
def _process( self ): av = AvatarHolder().getById(self._userId) if av.isActivated(): p = signIn.WPAccountAlreadyActivated( self, av ) return p.display() #return "your account is already activated" if av.isDisabled(): p = signIn.WPAccountDisabled( self, av ) return p.display() #return "your account is disabled. please, ask to enable it" elif self._key == av.getKey(): av.activateAccount() #----Grant any kind of rights if anything ph=pendingQueues.PendingQueuesHolder() ph.grantRights(av) #----- p = signIn.WPAccountActivated( self, av ) return p.display() #return "Your account is activate now" else: return "Wrong key. Please, ask for a new one" pass
def _process(self): av = AvatarHolder().getById(self._userId) if av.isActivated(): p = signIn.WPAccountAlreadyActivated(self, av) return p.display() #return "your account is already activated" if av.isDisabled(): p = signIn.WPAccountDisabled(self, av) return p.display() #return "your account is disabled. please, ask to enable it" elif self._key == av.getKey(): av.activateAccount() #----Grant any kind of rights if anything ph = pendingQueues.PendingQueuesHolder() ph.grantRights(av) #----- p = signIn.WPAccountActivated(self, av) return p.display() #return "Your account is activate now" else: return "Wrong key. Please, ask for a new one" pass