本文整理汇总了C#中IRole类的典型用法代码示例。如果您正苦于以下问题:C# IRole类的具体用法?C# IRole怎么用?C# IRole使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IRole类属于命名空间,在下文中一共展示了IRole类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: RoleUserController
public RoleUserController(IRoleUser repoRoleUser
, IRole repoRole, IPermission repoPer)
{
dalRoleUser = repoRoleUser;
dalRole = repoRole;
dalPermission = repoPer;
}
开发者ID:mmxftp,项目名称:JSMiracle.AutoWarehouse,代码行数:7,代码来源:RoleUserController.cs
示例2: RoleExpression
/// <summary>
/// Constructor
/// </summary>
/// <param name="roleAccessor">Role Property Accessor this instance will be returned by</param>
/// <param name="memberships">Other roles to participate in</param>
/// <param name="exclusions">Roles of which this role is excluded</param>
public RoleExpression(Expression<Func<IRole>> roleAccessor, IRole[] memberships, IRole[] exclusions)
{
Name = BindingHelper.Name(roleAccessor);
RoleMemberships = memberships.ToDictionary(r => r.Name);
RoleExclusions = exclusions.ToDictionary(r => r.Name);
}
开发者ID:Nieko,项目名称:Nieko,代码行数:13,代码来源:RoleExpression.cs
示例3: RemoveExclusions
private void RemoveExclusions(IRole role, Dictionary<string, IRole> roles, HashSet<IRole> parsedMemberships, HashSet<IRole> parsedExclusions)
{
foreach (var exclusion in role.RoleExclusions.Values)
{
if (parsedExclusions.Contains(exclusion))
{
continue;
}
if (roles.ContainsKey(exclusion.Name))
{
roles.Remove(exclusion.Name);
parsedExclusions.Add(exclusion);
}
RemoveExclusions(exclusion, roles, parsedMemberships, parsedExclusions);
}
foreach (var membership in role.RoleMemberships.Values)
{
if (parsedMemberships.Contains(membership))
{
continue;
}
parsedMemberships.Add(membership);
RemoveExclusions(membership, roles, parsedMemberships, parsedExclusions);
}
}
开发者ID:Nieko,项目名称:Nieko,代码行数:26,代码来源:RolesProviderBase.cs
示例4: RegisterAbilities
/// <summary>
/// Assign a set of abilities to a role.
/// </summary>
/// <param name="role">The role that is to be inspected and if nescessary configured</param>
/// <param name="abilities">The abilities to assign the role if nescessary</param>
public static void RegisterAbilities(IRole role, IEnumerable<IAbility> abilities)
{
// This method is intended to be used from the Global.asax.cs or
// similar. It should only be done from there to encourage a centralized
// place to assign abilities.
//
// You could additionally add the roles and abilities into this file
// but it was designed to be general enough to support most use cases
//
// The method is designed with dependency injection in mind which should allow
// any method of configuring roles and abilities (i.e. pulling roles from the database,
// or abilities through refection)
if (role == null)
throw new ArgumentNullException("role");
if (abilities == null)
throw new ArgumentNullException("abilities");
if (role.Abilities == null)
role.Abilities = new List<IAbility>();
foreach (IAbility ability in abilities)
role.Abilities.Add(ability);
AuthorizationService.AddRole(role);
}
开发者ID:Skookum,项目名称:Hero,代码行数:30,代码来源:HeroConfig.cs
示例5: AccountController
public AccountController(IUser userRepository, ISettings settingsRepository, IRole roleRepository)
: base(settingsRepository)
{
_userRepository = userRepository;
_roleRepository = roleRepository;
ExpectedMasterName = string.Empty;
}
开发者ID:rinckd,项目名称:sblog.net,代码行数:7,代码来源:AccountController.cs
示例6: AddRole
/// <summary>
/// Adds the role.
/// </summary>
/// <param name="role">The role.</param>
public void AddRole(IRole role)
{
using (Logger.Assembly.Scope())
{
RoleIds.Add(role.Id);
}
}
开发者ID:dotnetdesign,项目名称:WebSecurity,代码行数:11,代码来源:User.cs
示例7: UpdateAsync
public Task<int> UpdateAsync(IRole role)
{
if (String.IsNullOrEmpty(role.Id))
{
throw new ArgumentNullException("Id");
}
return roleRepository.UpdateAsync(role);
}
开发者ID:isimic413,项目名称:OnlineExamPrep,代码行数:8,代码来源:RoleService.cs
示例8: TaskContext
public TaskContext(IRole role)
{
Role = role;
Settings = new ExpandoObject();
StepIndex = 0;
TaskSteps = new List<TaskStep>();
}
开发者ID:AiDaTou,项目名称:DnTool,代码行数:8,代码来源:TaskContext.cs
示例9: CreateContext
/// <summary>
/// 根据流程和角色创建SOARoleContext
/// </summary>
/// <param name="role"></param>
/// <param name="process"></param>
/// <returns></returns>
public static SOARoleContext CreateContext(IRole role, IWfProcess process)
{
role.NullCheck("role");
SOARole soaRole = (SOARole)SOARole.CreateWrapperObject(role);
return CreateContext(soaRole.PropertyDefinitions, process);
}
开发者ID:jerryshi2007,项目名称:AK47Source,代码行数:14,代码来源:SOARoleContext.cs
示例10: AddRole
public IRole AddRole(IRole role)
{
foreach (IAbility ability in role.Abilities)
AddAbility(ability);
_roleRepository.Create(role);
return GetRole(role.Name);
}
开发者ID:Skookum,项目名称:Hero,代码行数:8,代码来源:AbilityAuthorizationService.cs
示例11: Character
public Character(string name, char gender, int age, IRole role, string race)
{
this.name = name;
this.gender = gender;
this.age = age;
this.role = role;
this.race = race;
// give random hair type , eye colour , hair colour
}
开发者ID:chriswestwood,项目名称:FYP,代码行数:9,代码来源:Character.cs
示例12: Initial
public void Initial()
{
if(PlayerGO != null) Player = PlayerGO.GetComponent<IRole>();
if(EnemyGO != null) Enemy = EnemyGO.GetComponent<IRole> ();
if(PlayerCameraGO != null) PlayerCam = PlayerCameraGO.GetComponent<ICamera> ();
if(EnemyCameraGO != null) EnemyCam = EnemyCameraGO.GetComponent<ICamera> ();
if(BulletCameraGO != null) BulletCam = BulletCameraGO.GetComponent<ICamera> ();
if(MainCameraGO != null) MainCam = MainCameraGO.GetComponent<ICamera> ();
}
开发者ID:Genesic,项目名称:WarGamingProject,代码行数:9,代码来源:ISceneFlow.cs
示例13: remove_role
public void remove_role(IRole role)
{
roles.RemoveAll(r => r.GetType() == role.GetType());
Contract.Ensures(
roles.Count > 0,
"Personnel must have at least one role"
);
}
开发者ID:skulifh,项目名称:conveyor_belt_simulator,代码行数:9,代码来源:Personnel.cs
示例14: CreateWrapperObject
public new static IRole CreateWrapperObject(IRole role)
{
IRole result = role;
if (role is SOARole == false)
result = new SOARole(role);
return result;
}
开发者ID:jerryshi2007,项目名称:AK47Source,代码行数:9,代码来源:SOARole.cs
示例15: HasRole
public Boolean HasRole(IRole role)
{
foreach (IRole personnel_role in this.roles)
{
if (role.GetType() == personnel_role.GetType()){
return true;
}
}
return false;
}
开发者ID:skulifh,项目名称:conveyor_belt_simulator,代码行数:10,代码来源:Personnel.cs
示例16: TaskContext
public TaskContext(IRole role)
{
if (role == null)
throw new Exception("角色不能为null");
Role = role;
Settings = new ExpandoObject();
StepIndex = 0;
TaskSteps = new List<TaskStep>();
}
开发者ID:rhjv55,项目名称:Utilities,代码行数:10,代码来源:TaskContext.cs
示例17: RenameRole
public IRole RenameRole(IRole role, String newRoleName)
{
if (role == null) throw new ArgumentNullException("role");
if (String.IsNullOrEmpty(newRoleName)) throw new ArgumentNullException("newRoleName");
role.Name = newRoleName;
this.RoleRepository.Update(role);
return role;
}
开发者ID:yaoyel,项目名称:Finework,代码行数:10,代码来源:RoleManager.cs
示例18: bindCheckBoxList
private static void bindCheckBoxList( SecurityTool tool, IBlock sblock, IRole role ) {
IBlock cbBlock = sblock.GetBlock( "checkboxs" );
IList checkValues = tool.GetCheckBoxList( role );
foreach (ActionVo av in checkValues) {
cbBlock.Set( "a.Name", av.Name );
cbBlock.Set( "a.Value", av.Value );
cbBlock.Set( "a.Checked", av.Checked );
cbBlock.Next();
}
}
开发者ID:2014AmethystCat,项目名称:wojilu,代码行数:10,代码来源:SecurityController.cs
示例19: Add
public static void Add(IContext context, IRole role)
{
Context ctx = context as Context;
if (ctx == null)
throw new Exception(typeof(Context).FullName + " expected.");
SqlCommand command = new SqlCommand("insert into Role (title) values (@Title)");
command.Parameters.Add(new SqlParameter("Title", role.Title));
command.ExecuteNonQuery();
}
开发者ID:NitrOxygeN1,项目名称:CrowdHunting,代码行数:11,代码来源:RoleUtility.cs
示例20: DeleteAsync
public Task<int> DeleteAsync(IRole entity)
{
try
{
return Repository.DeleteAsync(entity);
}
catch (Exception e)
{
throw new Exception(e.ToString());
}
}
开发者ID:math-os,项目名称:mathos-scheduler,代码行数:11,代码来源:RoleService.cs
注:本文中的IRole类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论