C# 클래스 Rock.Security.Authorization

Static class for managing authorizations
파일 보기 프로젝트 열기: SparkDevNetwork/Rock 1 사용 예제들

공개 메소드들

메소드 설명
AllowAllUsers ( ISecured entity, string action, RockContext rockContext = null ) : void

Allows all users.

AllowPerson ( ISecured entity, string action, Person person, RockContext rockContext = null ) : void

Updates authorization rules for the entity so that the current person is allowed to perform the specified action.

AllowSecurityRole ( ISecured entity, string action, Group group, RockContext rockContext = null ) : void

Allows the security role.

AuthRules ( int entityTypeId, int entityId, string action ) : List

Returns the authorization rules for the specified entity and action.

Authorized ( ISecured entity, string action, Rock person ) : bool

Evaluates whether a selected person is allowed to perform the selected action on the selected entity.

Authorized ( ISecured entity, string action, SpecialRole specialRole ) : bool

Evaluates whether a selected user is allowed to perform the selected action on the selected entity.

CopyAuthorization ( ISecured sourceEntity, ISecured targetEntity ) : void

Copies the authorization.

CopyAuthorization ( ISecured sourceEntity, ISecured targetEntity, RockContext rockContext, string action = "" ) : void

Copies the authorizations from one ISecured object to another

This method will save any previous changes made to the context

DecodeEntityTypeName ( string encodedTypeName ) : string

Decodes the entity type name.

EncodeEntityTypeName ( Type iSecuredType ) : string

Encodes the entity type name for use in a URL

EncodeEntityTypeName ( string assemblyQualifiedName ) : string

Encodes the entity type name for use in a URL

FindAuthRules ( ISecured securableObject ) : IQueryable

Finds the auth rules.

Flush ( ) : void

Clear the static Authorizations object

IsPrivate ( ISecured entity, string action, Person person ) : bool

Determines whether the specified entity is private. Entity is considered private if only the current user has access. In this scenario, the first rule would give current user access, and second rule would deny all users.

Load ( ) : bool

Load the static Authorizations object

MakePrivate ( ISecured entity, string action, Person person, RockContext rockContext = null ) : void

Makes the entity private by setting up two authorization rules, one granting the selected person, and then another that denies all other users.

MakeUnPrivate ( ISecured entity, string action, Person person, RockContext rockContext = null ) : void

Removes that two authorization rules that made the entity private.

RefreshAction ( int entityTypeId, int entityId, string action, RockContext rockContext ) : void

Reloads the action.

ReloadAction ( int entityTypeId, int entityId, string action ) : void

Reloads the action.

ReloadAction ( int entityTypeId, int entityId, string action, RockContext rockContext ) : void

Reloads the action.

ReloadEntity ( int entityTypeId, int entityId, RockContext rockContext = null ) : void

Reloads the entity.

SetAuthCookie ( string userName, bool isPersisted, bool IsImpersonated ) : void

Sets the auth cookie.

비공개 메소드들

메소드 설명
FlushAuth ( ) : void

Clear the static Authorizations object

ItemAuthorized ( ISecured entity, string action, Rock person, bool isRootEntity, bool checkParentAuthority ) : bool?

Checks to see if a person is authorized

ItemAuthorized ( ISecured entity, string action, SpecialRole specialRole, bool isRootEntity, bool checkParentAuthority ) : bool?

Checks to see if a special role is authorized

LoadAuths ( int entityTypeId, int entityId, RockContext rockContext ) : List

Loads the authorizations

MyAllow ( ISecured entity, string action, Person person = null, Group group = null, SpecialRole specialRole = SpecialRole.None, RockContext rockContext = null ) : void

Creates authorization rules to make the entity private to selected person

MyAllowAllUsers ( ISecured entity, string action, RockContext rockContext ) : void

Mies the allow all users.

MyMakePrivate ( ISecured entity, string action, Person person, RockContext rockContext ) : void

Makes the entity private for the selected action and person

MyMakeUnPrivate ( ISecured entity, string action, Person person, RockContext rockContext ) : void

If the entity is currently private for selected person, removes all the rules

RefreshAction ( int entityTypeId, int entityId, string action ) : void

Reloads the authorizations for the specified entity and action.

RefreshEntity ( int entityTypeId, int entityId, RockContext rockContext = null ) : void

Reloads the entity.

ResetAction ( int entityTypeId, int entityId, string action, List authRules ) : void

Resets the action.

메소드 상세

AllowAllUsers() 공개 정적인 메소드

Allows all users.
public static AllowAllUsers ( ISecured entity, string action, RockContext rockContext = null ) : void
entity ISecured The entity.
action string The action.
rockContext RockContext The rock context.
리턴 void

AllowPerson() 공개 정적인 메소드

Updates authorization rules for the entity so that the current person is allowed to perform the specified action.
public static AllowPerson ( ISecured entity, string action, Person person, RockContext rockContext = null ) : void
entity ISecured The entity.
action string The action.
person Person The person.
rockContext RockContext The rock context.
리턴 void

AllowSecurityRole() 공개 정적인 메소드

Allows the security role.
public static AllowSecurityRole ( ISecured entity, string action, Group group, RockContext rockContext = null ) : void
entity ISecured The entity.
action string The action.
group Group The group.
rockContext RockContext The rock context.
리턴 void

AuthRules() 공개 정적인 메소드

Returns the authorization rules for the specified entity and action.
public static AuthRules ( int entityTypeId, int entityId, string action ) : List
entityTypeId int The entity type id.
entityId int The entity id.
action string The action.
리턴 List

Authorized() 공개 정적인 메소드

Evaluates whether a selected person is allowed to perform the selected action on the selected entity.
public static Authorized ( ISecured entity, string action, Rock person ) : bool
entity ISecured The entity.
action string The action.
person Rock The person.
리턴 bool

Authorized() 공개 정적인 메소드

Evaluates whether a selected user is allowed to perform the selected action on the selected entity.
public static Authorized ( ISecured entity, string action, SpecialRole specialRole ) : bool
entity ISecured The entity.
action string The action.
specialRole SpecialRole The special role.
리턴 bool

CopyAuthorization() 공개 정적인 메소드

Copies the authorization.
public static CopyAuthorization ( ISecured sourceEntity, ISecured targetEntity ) : void
sourceEntity ISecured The source entity.
targetEntity ISecured The target entity.
리턴 void

CopyAuthorization() 공개 정적인 메소드

Copies the authorizations from one ISecured object to another
This method will save any previous changes made to the context
public static CopyAuthorization ( ISecured sourceEntity, ISecured targetEntity, RockContext rockContext, string action = "" ) : void
sourceEntity ISecured The source entity.
targetEntity ISecured The target entity.
rockContext RockContext The rock context.
action string Optional action (if ommitted or left blank, all actions will be copied).
리턴 void

DecodeEntityTypeName() 공개 정적인 메소드

Decodes the entity type name.
public static DecodeEntityTypeName ( string encodedTypeName ) : string
encodedTypeName string Name of the encoded type.
리턴 string

EncodeEntityTypeName() 공개 정적인 메소드

Encodes the entity type name for use in a URL
public static EncodeEntityTypeName ( Type iSecuredType ) : string
iSecuredType System.Type Type of the item to secure.
리턴 string

EncodeEntityTypeName() 공개 정적인 메소드

Encodes the entity type name for use in a URL
public static EncodeEntityTypeName ( string assemblyQualifiedName ) : string
assemblyQualifiedName string Assembly name of the item to secure.
리턴 string

FindAuthRules() 공개 정적인 메소드

Finds the auth rules.
public static FindAuthRules ( ISecured securableObject ) : IQueryable
securableObject ISecured The securable object.
리턴 IQueryable

Flush() 공개 정적인 메소드

Clear the static Authorizations object
public static Flush ( ) : void
리턴 void

IsPrivate() 공개 정적인 메소드

Determines whether the specified entity is private. Entity is considered private if only the current user has access. In this scenario, the first rule would give current user access, and second rule would deny all users.
public static IsPrivate ( ISecured entity, string action, Person person ) : bool
entity ISecured The entity.
action string The action.
person Person The person.
리턴 bool

Load() 공개 정적인 메소드

Load the static Authorizations object
public static Load ( ) : bool
리턴 bool

MakePrivate() 공개 정적인 메소드

Makes the entity private by setting up two authorization rules, one granting the selected person, and then another that denies all other users.
public static MakePrivate ( ISecured entity, string action, Person person, RockContext rockContext = null ) : void
entity ISecured The entity.
action string The action.
person Person The person.
rockContext RockContext The rock context.
리턴 void

MakeUnPrivate() 공개 정적인 메소드

Removes that two authorization rules that made the entity private.
public static MakeUnPrivate ( ISecured entity, string action, Person person, RockContext rockContext = null ) : void
entity ISecured The entity.
action string The action.
person Person The person.
rockContext RockContext The rock context.
리턴 void

RefreshAction() 공개 정적인 메소드

Reloads the action.
public static RefreshAction ( int entityTypeId, int entityId, string action, RockContext rockContext ) : void
entityTypeId int The entity type identifier.
entityId int The entity identifier.
action string The action.
rockContext RockContext The rock context.
리턴 void

ReloadAction() 공개 정적인 메소드

Reloads the action.
public static ReloadAction ( int entityTypeId, int entityId, string action ) : void
entityTypeId int The entity type identifier.
entityId int The entity identifier.
action string The action.
리턴 void

ReloadAction() 공개 정적인 메소드

Reloads the action.
public static ReloadAction ( int entityTypeId, int entityId, string action, RockContext rockContext ) : void
entityTypeId int The entity type identifier.
entityId int The entity identifier.
action string The action.
rockContext RockContext The rock context.
리턴 void

ReloadEntity() 공개 정적인 메소드

Reloads the entity.
public static ReloadEntity ( int entityTypeId, int entityId, RockContext rockContext = null ) : void
entityTypeId int The entity type identifier.
entityId int The entity identifier.
rockContext RockContext The rock context.
리턴 void

SetAuthCookie() 공개 정적인 메소드

Sets the auth cookie.
public static SetAuthCookie ( string userName, bool isPersisted, bool IsImpersonated ) : void
userName string Name of the user.
isPersisted bool if set to true [is persisted].
IsImpersonated bool if set to true [is impersonated].
리턴 void