Accessing pages in a namespace - namespaces

I'm using blueSpice to create a wiki, I want to assign pages to a specific namespace, I just created few custom groups and assigned some pages to those groups and then in the permission manager I gave some roles to a namespace that I created but the problem is that there is no pages assign to my custom namespace.
I really don't know how to fix my problem I hope that someone has the answer.

Related

When to create a module in Yii2 Advanced template?

I am little confused before starting a new project in Yii2 advanced template. So, i am asking this question.
I have done some projects in "Yii2 basic" app in which we use modules for different parts of our application like for adminpanel, api we create different folders in 'modules folder'.
I had also done a project in Yii2 advanced template it was multiapp project so we used advanced template. As we already had 'backend' and 'frontend' separated in Yii2 advanced template so we didn't created any module in 'modules' folder.
Now, i want to ask what is right approach. like in my new project we have users and products in backend so is it appropriate to create different modules for them in 'modules' folder or will it be ok if i create there controllers and models directly in backend folder.
what are the advantages of using modules folder in advanced template?
Thanks for answers in advance.
The advantage of module's use is primarly the possibilities of a resue of this components in several diffferente project. you can easly separate you common repetative functionalities in several modules and use the same code in different prject indipendently of the "template" or scaffolding you use for the single applicazione or group of applications.
Do the fact the modules are self-contained software units that consist of models, views, controllers, and other supporting components
modules are, not only usable as a sort of mini-applications, but also as a easy way for code organization and reuse.
Modules are used to reduce our work.
Example:
In most of projects have user login function like login , signup ,
forget passsword ,password reset.
If you write code for these functions as module . You can use any
project
So there is know need to write one code again and again.

Yii2 Rbac not able to add new roles

In my Yii2 project previously I had worked on rbac, set it up as in the yii2 doc click here. Now I worked on different modules and I am back on rbac. Initially set it up with just sysadmin and staff. Now I want to add a new role along with the two previous roles. Which I did it auth_item table and assigned the user_id in the auth_assignmnet table to the new role created.
In my controller added the role name for which actions he can access. But still throws Forbidden Exception. Tried different things but unable to work on it..
Any solution for this?
First of all, you should modify RBAC structure using the provided authManager methods.
After adding new RBAC items manually in database or files you need to make sure cache is not keeping the old data.
Flush cache manually or call console method like
yii cache/flush-all

Personal wiki: changing the names of several pages

In my wiki I sent in a request to add a new namespace called 'Exchange', however adding the new namespace will delete all pages with the name 'Exchange:blahblah'. So I would need to change the page name for all these pages before requesting to add the namespace. The problem is that there are just under 1000 pages such as 'Exchange:blahblah' and changing the names of all of them would take up too much time.
My question is how, if possible, can I change the names of all these pages without having to manually alter the name individually. That is, if I wanted to change every exchange page from 'Exchange:blahblah' to 'Exchange1:blahblah', then is there a quick and easy way to change them all. All the pages are under the same category, if that helps.
Any advice would be greatly appreciated.
Add the namespace then run php maintenance/namespaceDupes.php --fix --move-talk from shell. See its documentation for details.

Organizing a large number of classes under a Namespace

We are converting windows applications to browser based in .Net using Visual Studio 2010. While I'm not new to .Net, I am new to creating applications based on 3 tier architecture. I want to create classes for each table in our database and put them under a Namespace. The class name will be the same as the table name, so each class in the the Namespace would be referenced something like CompanyName.ProductName.Entity.{table name}. Now for my questions:
Is this feasable?
Would I create seperate project for each table class? Note that new table classes will be created as more programs are converted.
Does this create one huge .dll?
How do other developers access the classes I created, and where are they stored so I can reference the classes with the Using directive?
Always create the class names with individual cs file, so it will be easy to do versioning of files. It does not relate to size of dll if we keep the class in a single file or multiple files.
Create the folder structure like Project > ProductName > Classes in your solution.
Would I create seperate project for each table class?
No, don't create a separate project for each table class. That's too granular.
Does this create one huge .dll?
Each project would create a separate DLL by default (I believe you can do things with IL merge to change that.) However, each namespace does not have a direct relationship to DLLs. That is, you can have multiple namespaces in a single DLL.
What we've typically done is create a DAL library. This would be it's own project, usually named something like ProductName.Data Then within that we might have a namespace like ProductName.Data.Models or ProductName.Data.Repositories.
Namespaces are largely used to help YOU organize the code. They also help out the compiler. For example, if you have a database class named Users, and it's in XYZ.Data, you can still have a view model named Users if it's in a separate namespace, e.g. XYZ.ViewModels.
Another thing that we've done is to keep the root namespace the same across DLLs for the same product. So we recently had our database in XYZ.Data. Then we put our application specific logic in a separate DLL and named it XYZ.AppLogic We also had view models in the namespace XYZ.ViewModels.
I don't believe there are any hard/fast rules that limit the number of namespaces you have. By default, Studio will try to create a new namespace for each folder in your project. That said, I often try to avoid namespace overload, because I don't want to see something like this at the top of my files:
using XYZ.Data.Models.Accounts;
using XYZ.Data.Models.Users;
using XYZ.AppLogic.Authentication;
using XYZ.AppLogic.Users;
using XYZ.AppLogic.Settings;
using XYZ.ViewModels.UserPreferences;
However, that's more of a personal preference than anything else.
EDIT Solution View
MySolution
MyProj.Data
Models
User.cs
Account.cs
Settings.cs
Repository
UserRepository.cs
AccountRepository.cs
User.cs is my POCO (Plain Ol' CLR Object) that defines the table.
The Repository folder has things specific to my ORM (I'm using PetaPoco) which let me actually access my user data.
For example, my UserRepository might have a method
public User GetById(int id)
{
var db = new Database(<myConnectionStringName>);
return db.SingleOrDefault<User>(id);
}
That syntax is specific to PetaPoco, but it is how I separate the data object from the actual DB connection.
The simple answer that I was looking for is to create one solution with my namespace as the default namespace. For each file, create a new class, and specify the namespace in each. Thanks to all who responded.

Delete accounts with Razor Web Pages

So, I'm working through a basic membership management admin panel but I can't quite figure out how to delete a user account. I can create one easily enough with the WebSecurity class, but this class doesn't appear to have any functions to delete an account.
What exactly do i have to do to get this functionality?
Edit: If you are using ASP.NET Web Pages 2 you are now able to accomplish the above by calling the DeleteUser() and DeleteAccount() functions available in WebMatrix.WebData.SimpleMembershipProvider. If you are using ASP.NET Web Pages 1 the answer is still valid. Refer to the SimpleMembershipProvider Class MSDN documenation for more information.
You will have to write your own code to delete the account. It's simply an entry in your database, so use the Database helper to remove the relevant rows from the webpages_UserInRoles,webpages_Membership and UserProfile tables.
The checkmarked answer is incorrect. Use
Membership.DeleteUser()