void OnCreateRole(object sender, EventArgs e) { IRoleManager roleManager = UserManagerProviderFactory.CreateRoleManager(); // new AspNetSqlProviderService(m_Url); string[] roles = roleManager.GetAllRoles(m_Application); Predicate <string> exists = delegate(string role) { return(role == m_RoleTextBox.Text); }; if (Array.Exists(roles, exists)) { m_RoleValidator.SetError(m_RoleTextBox, "Role already exists"); return; } m_RoleValidator.Clear(); if (m_RoleTextBox.Text == String.Empty) { m_RoleValidator.SetError(m_RoleTextBox, "Role cannot be empty"); return; } m_RoleValidator.Clear(); roleManager.CreateRole(m_Application, m_RoleTextBox.Text); m_Roles.Add(m_RoleTextBox.Text); m_CreatedRolesListView.AddItem(m_RoleTextBox.Text, true); m_RoleTextBox.Focus(); m_RoleTextBox.Text = String.Empty; }
public Startup ConfigureEvents() { Bot client = Container.Get <Bot>(); IUserManager userManager = Container.Get <IUserManager>(); IRoleManager roleManager = Container.Get <IRoleManager>(); IChannelManager channelManager = Container.Get <IChannelManager>(); IGuildManager guildManager = Container.Get <IGuildManager>(); client.ChannelCreated += channelManager.OnChannelCreatedAsync; client.ChannelDestroyed += channelManager.OnChannelDestroyedAsync; client.ChannelUpdated += channelManager.OnChannelUpdatedAsync; client.GuildMemberUpdated += guildManager.OnGuildMemberUpdatedAsync; client.GuildUpdated += guildManager.OnGuildUpdatedAsync; client.RoleCreated += roleManager.OnRoleCreatedAsync; client.RoleDeleted += roleManager.OnRoleDeletedAsync; client.RoleUpdated += roleManager.OnRoleUpdatedAsync; client.Ready += () => userManager.OnClientReadyAsync(client.Guilds); client.JoinedGuild += userManager.OnClientJoinedGuildAsync; client.UserBanned += userManager.OnUserBannedAsync; client.UserJoined += userManager.OnUserJoinedAsync; client.UserLeft += userManager.OnUserLeftAsync; client.UserUnbanned += userManager.OnUserUnbannedAsync; client.UserUpdated += userManager.OnUserUpdatedAsync; return(this); }
public RoleController( IRoleManager roleManager , IRoleRepository roleRepository) { _roleManager = roleManager; _roleRepository = roleRepository; }
public LoginController(IAccountManager iAccountManager, IRoleAccountManager iRoleAccountManager, IRoleManager iRoleManager) { _iAccountManager = iAccountManager; _iRoleAccountManager = iRoleAccountManager; _iRoleManager = iRoleManager; }
public RoleService( IRoleRepository roleRepository, IRoleManager roleManager) { _roleRepository = roleRepository; _roleManager = roleManager; }
void OnDeleteRole(object sender, EventArgs e) { DialogResult result = MessageBox.Show("Are you sure you want to delete the role " + RoleName + " ?", "Credentials Manager", MessageBoxButtons.OKCancel); if (result == DialogResult.OK) { IRoleManager roleManager = UserManagerProviderFactory.CreateRoleManager(); // new AspNetSqlProviderService(ServiceAddress); try { bool deleted = roleManager.DeleteRole(ApplicationName, RoleName, m_ThrowIfPopulatedCheckBox.Checked); if (deleted == false) { MessageBox.Show("Encountered an error trying to delete role " + m_RolesListView.CurrentListViewItem, "Credentials Manager", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { m_RolesListView.RemoveItem(RoleName); RefreshUsersForRoleComboBox(); RefreshRolesForUserComboBox(); RefreshRolePageButtons(); } } catch (SoapException exception) { if (exception.Message.Contains("This role cannot be deleted because there are users present in it")) { MessageBox.Show("Failed to delete role " + m_RolesListView.CurrentListViewItem + " because it was populated.", "Credentials Manager", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { throw; } } } }
public RolesController(IRoleManager roleManager, IUserManager userManager, IMapper mapper) : base(mapper) { _roleManager = roleManager; _userManager = userManager; }
/// <summary> /// 初始化角色服务 /// </summary> /// <param name="unitOfWork">工作单元</param> /// <param name="roleRepository">角色仓储</param> /// <param name="roleManager">角色服务</param> public RoleService(IGreatWallUnitOfWork unitOfWork, IRoleRepository roleRepository, IRoleManager roleManager) : base(unitOfWork, roleRepository) { UnitOfWork = unitOfWork; RoleRepository = roleRepository; RoleManager = roleManager; }
/// <summary> /// 构造器 /// </summary> /// <param name="context"></param> /// <param name="userRoleManager"></param> /// <param name="userManager"></param> /// <param name="roleManager"></param> public UserRolesController(ApplicationDbContext context, IUserRoleManager userRoleManager, IUserManager <UserJson> userManager, IRoleManager <RoleJson> roleManager) { _context = context; UserRoleManager = userRoleManager; UserManager = userManager; RoleManager = roleManager; }
public Client(IRoleManager manager) { var user = manager.GetUser(); var role = manager.GetRoles(user); manager.DoSomething(); }
/// <summary> /// 初始化角色服务 /// </summary> /// <param name="unitOfWork">工作单元</param> /// <param name="roleManager">角色服务</param> /// <param name="roleRepository">角色仓储</param> public RoleService(ISampleUnitOfWork unitOfWork, IRoleManager roleManager, IRoleRepository roleRepository) : base(unitOfWork, roleRepository) { UnitOfWork = unitOfWork; RoleManager = roleManager; RoleRepository = roleRepository; }
internal static void TestGetRolesWithDomain(IRoleManager roleManager, string name, string domain, List <string> expectResult) { List <string> result = roleManager.GetRoles(name, domain); string message = $"{name}: {result}, supposed to be {expectResult}"; Assert.True(Utility.SetEquals(expectResult, result), message); }
public void BuildRoleLinks(IRoleManager roleManager) { RoleManager = roleManager; int count = Value.ToCharArray().Count(x => x == '_'); foreach (var rule in Policy) { if (count < 2) { throw new Exception("the number of \"_\" in role definition should be at least 2"); } if (rule.Count < count) { throw new Exception("grouping policy elements do not meet role definition"); } if (count == 2) { roleManager.AddLink(rule[0], rule[1]); } else if (count == 3) { roleManager.AddLink(rule[0], rule[1], rule[2]); } else if (count == 4) { roleManager.AddLink(rule[0], rule[1], rule[2], rule[3]); } } }
public UserController(IUserManager usrManager, IRoleManager roleManager, ILogger <UserController> log, UserManager <ApplicationUser> userManager) { this.usrManager = usrManager; this.roleManager = roleManager; _userManager = userManager; _log = log; }
internal static AbstractFunction GenerateGFunction(string name, IRoleManager rm) { bool Call(string arg1, string arg2, string domain = null) { if (rm == null) { return(arg1.Equals(arg2)); } else { bool res; if (!String.IsNullOrEmpty(domain)) { res = rm.HasLink(arg1, arg2, domain); return(res); } res = rm.HasLink(arg1, arg2); return(res); } } GCall call = Call; return(new AviatorFunction(name, call)); }
void OnRemoveUserFromRole(object sender, EventArgs e) { string role = m_RolesListView.CurrentListViewItem; Debug.Assert(!String.IsNullOrEmpty(role)); IRoleManager roleManager = UserManagerProviderFactory.CreateRoleManager(); // new AspNetSqlProviderService(ServiceAddress); IUserManager userManager = roleManager as IUserManager; Debug.Assert(userManager != null); if (userManager.IsInRole(ApplicationName, UserToAssign, role)) { DialogResult result = MessageBox.Show("Are you sure you want to remove the user " + UserToAssign + " from the role " + m_RolesListView.CurrentListViewItem + " ?", "Credentials Manager", MessageBoxButtons.OKCancel); if (result == DialogResult.OK) { roleManager.RemoveUserFromRole(ApplicationName, UserToAssign, role); RefreshRolesForUserComboBox(); RefreshUsersForRoleComboBox(); RefreshRolePageButtons(); } } else { MessageBox.Show("The user " + UserToAssign + " is not a member of the role " + m_RolesListView.CurrentListViewItem, "Credentials Manager", MessageBoxButtons.OKCancel, MessageBoxIcon.Error); } }
public InvoiceRowItemAdapter(Context context, IRoleManager roleManager) : base(context, roleManager, Resource.Layout.InvoiceRowItem) { DeleteVisibility = roleManager.Permissions.ContainsKey(Resource.Id.InvoiceRowItemDelete) ? ViewStates.Visible : ViewStates.Invisible; ReadVisibility = roleManager.Permissions.ContainsKey(Resource.Id.InvoiceRowItemInfo) ? ViewStates.Visible : ViewStates.Invisible; _styleProvider = ColorConditionalStyleProvider.Instance; _itemsFormat = _context.Resources.GetString(Resource.String.InvoiceEntries); }
public GoodsDispatchedNotesAdapter(Context context, IRoleManager roleManager) : base(context, roleManager, Resource.Layout.GoodsDispatchedNotesRowItem) { DeleteVisibility = roleManager.Permissions.ContainsKey(Resource.Id.GoodsDispatchedNoteRowItemDelete) ? ViewStates.Visible : ViewStates.Invisible; ReadVisibility = roleManager.Permissions.ContainsKey(Resource.Id.GoodsDispatchedNoteRowItemInfo) ? ViewStates.Visible : ViewStates.Invisible; _styleProvider = ColorConditionalStyleProvider.Instance; }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IHostingEnvironment env, IServiceProvider serviceProvider, IRoleManager roleManager) { if (env.IsDevelopment()) { app.UseBrowserLink(); app.UseDeveloperExceptionPage(); app.UseDatabaseErrorPage(); } else { app.UseExceptionHandler("/Home/Error"); } app.UseRequestLocalization(); app.UseStaticFiles(); app.UseAuthentication(); app.UseMvc(routes => { routes.MapRoute( name: "default", template: "{controller=Home}/{action=Index}/{id?}"); }); //CreateRoles(serviceProvider, roleManager).Wait(); }
public UserController() { _userManager = new UserManager(); _roleManager = new RoleManager(); _postManager = new PostManager(); _deptManager = new DeptManager(); }
public AuthorizationDialog(string url, string application, string user) : this() { m_Url = url; m_ApplicationTextBox.Text = application; m_UserComboBox.Text = user; IRoleManager roleManager = UserManagerProviderFactory.CreateRoleManager(); string[] roles = roleManager.GetRolesForUser(application, user); m_RoleComboBox.Items.AddRange(roles); if (roles.Length > 0) { m_RoleComboBox.Text = roles[roles.Length - 1]; } IMembershipManager membershipManager = roleManager as IMembershipManager; string[] users = membershipManager.GetAllUsers(application); m_UserComboBox.Items.AddRange(users); if (users.Length > 0) { m_UserComboBox.Text = users[users.Length - 1]; } }
public void testSetup() { _roleMock = new RoleAccessorMock(); _roleManager = new RoleManager(_roleMock); _roles = new List <Role>(); _roles = _roleManager.RetrieveAllRoles(); }
public OwnersController(ApplicationDbContext context, IUserHelper userHelper, ICurrentUserFactory currentUser, IRoleManager roleManager) : base(context, userHelper, currentUser) { _roleManager = roleManager; _userHelper = userHelper; recordHelper = new RecordsHelper(context); }
// private UserInfo userInfo = new UserInfo(); public AuthorityManager() { // //TODO: 在此处添加构造函数逻辑 // //TcpClientChannel channel = new TcpClientChannel(); //ChannelServices.RegisterChannel(channel, false); //string strRBPCServiceURL = ConfigurationManager.AppSettings["RBPC.Service.url"].ToString(); //string strRBPCServicePort = ConfigurationManager.AppSettings["RBPC.Service.port"].ToString(); string strRBPCServiceURL = ConfigurationManager.AppSettings["RBPCServiceAddress"].ToString(); string strRBPCServicePort = ConfigurationManager.AppSettings["RBPCServicePort"].ToString(); //string tcpChannel = "tcp://" + strRBPCServiceURL + ":" + strRBPCServicePort + "/"; string strAccountMgrURL = "tcp://" + strRBPCServiceURL + ":" + strRBPCServicePort + "/IAccountManager"; log.Debug("*-*-strAccountMgrURL=" + strAccountMgrURL); string strPermissionMgrURL = "tcp://" + strRBPCServiceURL + ":" + strRBPCServicePort + "/IPermissionManager"; log.Debug("*-*-strPermissionMgrURL=" + strPermissionMgrURL); string strRoleMgrURL = "tcp://" + strRBPCServiceURL + ":" + strRBPCServicePort + "/IRoleManager"; log.Debug("*-*-strRoleMgrURL=" + strRoleMgrURL); string strSecurityMgrURL = "tcp://" + strRBPCServiceURL + ":" + strRBPCServicePort + "/ISecurityManager"; log.Debug("*-*-strSecurityMgrURL=" + strSecurityMgrURL); accountMgr = (IAccountManager)Activator.GetObject(typeof(IAccountManager), strAccountMgrURL); permissionMgr = (IPermissionManager)Activator.GetObject(typeof(IPermissionManager), strPermissionMgrURL); roleMgr = (IRoleManager)Activator.GetObject(typeof(IRoleManager), strRoleMgrURL); securityMgr = (ISecurityManager)Activator.GetObject(typeof(ISecurityManager), strSecurityMgrURL); application = System.Configuration.ConfigurationManager.AppSettings.Get("RBPCApplication").ToString(); }
private void InitializeInterpreter() { Dictionary <String, AbstractFunction> functions = new Dictionary <string, AbstractFunction>(); foreach (var entry in fm.FunctionDict) { String key = entry.Key; var function = entry.Value; functions.Add(key, function); } if (model.Model.ContainsKey("g")) { foreach (var entry in model.Model["g"]) { String key = entry.Key; Assertion ast = entry.Value; IRoleManager rm = ast.RM; functions.Add(key, BuiltInFunctions.GenerateGFunction(key, rm)); } } _interpreter = new Interpreter(); foreach (var func in functions) { _interpreter.SetFunction(func.Key, func.Value); } _parsedExpression = null; }
public MermberManager(IUserInfoService userInfoService, IUserTicketService userTicketService, IUserClientTypeQueryService userClientTypeQueryService, IPowerManager powerManager, IRoleManager roleManager, ICacheManager cacheManager, IUserPowerStore userPowerStore, IMemberPowerStore memberPowerStore, IMemberQueryService memberQueryService, IMemberAppService memberAppService, IConLogQueryService conLogQueryService, IAuthRankQueryService authRankQueryService) : base(userInfoService, userTicketService, userClientTypeQueryService, powerManager, roleManager, cacheManager, userPowerStore, memberAppService, conLogQueryService, authRankQueryService) { _memberPowerStore = memberPowerStore; _memberQueryService = memberQueryService; }
/// <summary> /// 初始化一个<see cref="AdministratorService"/>类型的实例 /// </summary> /// <param name="unitOfWork">工作单元</param> /// <param name="administratorManager">管理员管理</param> /// <param name="roleManager">角色管理</param> public AdministratorService(IAdminUnitOfWork unitOfWork , IAdministratorManager administratorManager , IRoleManager roleManager) { UnitOfWork = unitOfWork; AdministratorManager = administratorManager; RoleManager = roleManager; }
public RoleManagerTest() { roleRequest = new RoleRequest(); roleRequest.RoleId = ROLE_ID; roleRequest.Description = ROLE_DESCRIPTION; mockRoleRepository = new StubRoleRepository(); roleManager = new RoleManager(mockRoleRepository); }
public UserController(IUserManager userManager, IRoleManager roleManager, IArticleManager articleManager, ILogger.ILogger logger, ICommentManager comManager) { this.userManager = userManager; this.roleManager = roleManager; this.articleManager = articleManager; this.logger = logger; this.comManager = comManager; }
public AppEnvironment(IKeyManager keyManager, IServiceManager serviceManager, IRoleManager roleManager, IApiManager apiManager, IStringLocalizer <IAppEnvironment> stringLocalizer) { _keyManager = keyManager; _serviceManager = serviceManager; _roleManager = roleManager; _apiManager = apiManager; _stringLocalizer = stringLocalizer; }
public LibraryManager() { _roleManager = new RoleManager(); _userManager = new UserManager(_roleManager); _itemsManager = new RentItemsManager(); _rentalSystem = new RentalManager(); }
public AuthorityManager() { permissionManager = RBPCAgent.getRBPCManager<IPermissionManager>(); securityManager = RBPCAgent.getRBPCManager<ISecurityManager>(); roleManager = RBPCAgent.getRBPCManager<IRoleManager>(); accountManager = RBPCAgent.getRBPCManager<IAccountManager>(); appName = ConfigurationManager.AppSettings["RBPCApplication"].ToString(); }
public RoleBasedAuthorizationService( IPermissionDefinitionManager permissionDefinitionManager, IRoleManager roleManager, IUserRoleManager userRoleManager) { _permissionDefinitionManager = permissionDefinitionManager; _roleManager = roleManager; _userRoleManager = userRoleManager; Logger = NullLogger.Instance; }
public GroupService(IMembershipDataSource dataSource, IGroupManager groupManager, IUserManager userManager, IRoleManager roleManager) { if (!StrixMembership.Configuration.UseGroups) { throw new InvalidOperationException(Resources.Interface.GroupsNotEnabed); } this._dataSource = dataSource; this._groupManager = groupManager; this._userManager = userManager; this._roleManager = roleManager; }
public AccountService( IMembershipDataSource dataSource, ISecurityManager securityManager, IUserManager userManager, IRoleManager roleManager, IMembershipMailer mailer) { this._dataSource = dataSource; this._securityManager = securityManager; this._userManager = userManager; this._roleManager = roleManager; this._mailer = mailer; }
public RoleManagerMock() { _dataSourceMock.RegisterData<Application>(new List<Application> { MembershipTestData.Application }); _dataSourceMock.RegisterData<Role>(MembershipTestData.Roles); _dataSourceMock.RegisterData<User>(MembershipTestData.Users); _dataSourceMock.RegisterData<Group>(MembershipTestData.Groups); _dataSourceMock.RegisterData<GroupInRole>(MembershipTestData.GroupsInRoles); _dataSourceMock.RegisterData<UserInRole>(MembershipTestData.UsersInRoles); _dataSourceMock.Mock.Setup(m => m.Find<GroupInRole>(It.IsAny<object[]>())).Returns<object[]>(p => _dataSourceMock.DataList<GroupInRole>().FirstOrDefault(r => r.GroupId == (Guid)p[0] && r.RoleId == (Guid)p[1])); _dataSourceMock.Mock.Setup(m => m.Find<UserInRole>(It.IsAny<object[]>())).Returns<object[]>(p => _dataSourceMock.DataList<UserInRole>().FirstOrDefault(r => r.GroupRoleGroupId == (Guid)p[0] && r.GroupRoleRoleId == (Guid)p[1] && r.UserId == (Guid)p[2])); _roleManager = new RoleManager(_dataSourceMock.Mock.Object); }
public AdminController( IAuthorizationService authorizationService, ITypeFeatureProvider typeFeatureProvider, ISession session, IStringLocalizer<AdminController> stringLocalizer, ISiteService siteService, IShapeFactory shapeFactory, IRoleManager roleManager, IEnumerable<IPermissionProvider> permissionProviders ) { _typeFeatureProvider = typeFeatureProvider; _permissionProviders = permissionProviders; _roleManager = roleManager; _shapeFactory = shapeFactory; _siteService = siteService; T = stringLocalizer; _authorizationService = authorizationService; _session = session; }
/// <summary> /// Initializes a new instance of the <see cref="UserController"/> class. /// </summary> /// <param name="userManager">The user manager to inject.</param> /// <param name="roleManager">The role manager to inject.</param> /// <param name="logService">The log service to inject.</param> public UserController(IUserManager userManager, IRoleManager roleManager, ILogService logService) { _userManager = userManager; _roleManager = roleManager; _logService = logService; }
public AuthorityManager(string strEditorID) { string strRBPCServiceURL = ConfigurationManager.AppSettings["RBPCServiceAddress"].ToString(); string strRBPCServicePort = ConfigurationManager.AppSettings["RBPCServicePort"].ToString(); string strAccountMgrURL = "tcp://" + strRBPCServiceURL + ":" + strRBPCServicePort + "/IAccountManager"; string strPermissionMgrURL = "tcp://" + strRBPCServiceURL + ":" + strRBPCServicePort + "/IPermissionManager"; string strRoleMgrURL = "tcp://" + strRBPCServiceURL + ":" + strRBPCServicePort + "/IRoleManager"; string strSecurityMgrURL = "tcp://" + strRBPCServiceURL + ":" + strRBPCServicePort + "/ISecurityManager"; accountMgr = (IAccountManager)Activator.GetObject(typeof(IAccountManager), strAccountMgrURL); permissionMgr = (IPermissionManager)Activator.GetObject(typeof(IPermissionManager), strPermissionMgrURL); roleMgr = (IRoleManager)Activator.GetObject(typeof(IRoleManager), strRoleMgrURL); securityMgr = (ISecurityManager)Activator.GetObject(typeof(ISecurityManager), strSecurityMgrURL); application = System.Configuration.ConfigurationManager.AppSettings.Get("RBPCApplication").ToString(); // TODO: Complete member initialization editorID = Int64.Parse(strEditorID); }
public AuthorityManager(UserInfo ui) : this() { string strRBPCServiceURL = ConfigurationManager.AppSettings["RBPCServiceAddress"].ToString(); string strRBPCServicePort = ConfigurationManager.AppSettings["RBPCServicePort"].ToString(); string strAccountMgrURL = "tcp://" + strRBPCServiceURL + ":" + strRBPCServicePort + "/IAccountManager"; string strPermissionMgrURL = "tcp://" + strRBPCServiceURL + ":" + strRBPCServicePort + "/IPermissionManager"; string strRoleMgrURL = "tcp://" + strRBPCServiceURL + ":" + strRBPCServicePort + "/IRoleManager"; string strSecurityMgrURL = "tcp://" + strRBPCServiceURL + ":" + strRBPCServicePort + "/ISecurityManager"; accountMgr = (IAccountManager)Activator.GetObject(typeof(IAccountManager), strAccountMgrURL); permissionMgr = (IPermissionManager)Activator.GetObject(typeof(IPermissionManager), strPermissionMgrURL); roleMgr = (IRoleManager)Activator.GetObject(typeof(IRoleManager), strRoleMgrURL); securityMgr = (ISecurityManager)Activator.GetObject(typeof(ISecurityManager), strSecurityMgrURL); application = System.Configuration.ConfigurationManager.AppSettings.Get("RBPCApplication").ToString(); editorID = ui.AccountId;//31989 }
public void InititalizeTests() { mockRoleManager = new Mock<RoleManager<ApplicationRole>>(); target = new ProomRoleManager(mockRoleManager.Object); }
public RoleService(IMembershipDataSource dataSource, IRoleManager roleManager) { this._dataSource = dataSource; this._roleManager = roleManager; }
public RolesService(IRoleManager roleManager, IMessageBusService messageBusService, IAuditService auditService) { _roleManager = roleManager; _messageBusService = messageBusService; _auditService = auditService; }
public AdministratorSecurityChecker(IWebContext context, IRoleManager manager, IConfigurationReader configurationReader) { _context = context; _manager = manager; _configurationReader = configurationReader; }