示例#1
0
 public void removPermission(Permission permission)
 {
     if (this.Permissions != null && this.Permissions.Contains(permission)) {
         this.Permissions.Remove(permission);
         permission.removUser(this);
     }
 }
示例#2
0
 public void addPermission(Permission permission)
 {
     if (this.Permissions == null) {
         this.Permissions = new List<Permission>();
     }
     this.Permissions.Add(permission);
     permission.addUser(this);
 }
        // POST: odata/Permissions
        public IHttpActionResult Post( Permission permission )
        {
            if ( !ModelState.IsValid ) {
                return BadRequest( ModelState );
            }

            db.PermissionSet.Add( permission );
            db.SaveChanges();

            return Created( permission );
        }
示例#4
0
 private static Permission generatePermisson( ModelContext context, string name, bool state )
 {
     try {
         Permission permission = new Permission() {
             Name = name,
             Credential = generateCredantial( context, state ),
             Task = generateTask( name )
         };
         context.PermissionSet.AddOrUpdate( p => p.Name, permission );
         Log.DebugFormat( $"generatePermisson: {permission.toString()}\nDONE" );
         return permission;
     } catch ( Exception e ) {
         Log.Error( "generatePermisson", e );
         return null;
     }
 }
示例#5
0
 public IUser(Permission permission)
     : base()
 {
     this.addPermission(permission);
 }