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

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

            return Created( permission );
        }
Ejemplo n.º 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;
     }
 }
Ejemplo n.º 5
0
 public IUser(Permission permission)
     : base()
 {
     this.addPermission(permission);
 }