Web permission database design, web permission Database

Source: Internet
Author: User

Web permission database design, web permission Database

CREATE TABLE    account    (        accid INT DEFAULT '0' NOT NULL,        accCode CHAR(20),        accName VARCHAR(30),        PRIMARY KEY (accid)    )    ENGINE=InnoDB DEFAULT CHARSET=utf8;CREATE TABLE    role    (        roleid INT DEFAULT '0' NOT NULL,        roleCode CHAR(20),        roleName VARCHAR(30),        PRIMARY KEY (roleid)    )    ENGINE=InnoDB DEFAULT CHARSET=utf8;CREATE TABLE    accrole    (        accroleid INT DEFAULT '0' NOT NULL,        faccid INT,        froleid INT,        PRIMARY KEY (accroleid),        CONSTRAINT AccRole_fk1 FOREIGN KEY (faccid) REFERENCES account (accid) ,        CONSTRAINT AccRole_fk2 FOREIGN KEY (froleid) REFERENCES role (roleid),        INDEX AccRole_fk1 (faccid),        INDEX AccRole_fk2 (froleid)    )    ENGINE=InnoDB DEFAULT CHARSET=utf8;CREATE TABLE    module    (        modid INT DEFAULT '0' NOT NULL,        modCode CHAR(20),        modName VARCHAR(30),        parentCode CHAR(20),        url VARCHAR(50),        PRIMARY KEY (modid)    )    ENGINE=InnoDB DEFAULT CHARSET=utf8;CREATE TABLE    privilege    (        priid INT DEFAULT '0' NOT NULL,        priCode CHAR(20),        priName VARCHAR(30),        PRIMARY KEY (priid)    )    ENGINE=InnoDB DEFAULT CHARSET=utf8;CREATE TABLE    modpri    (        modpriid INT DEFAULT '0' NOT NULL,        modid INT,        priid INT,        PRIMARY KEY (modpriid),        CONSTRAINT modpri_fk1 FOREIGN KEY (modid) REFERENCES module (modid) ,        CONSTRAINT modpri_fk2 FOREIGN KEY (priid) REFERENCES privilege (priid),        INDEX modpri_fk1 (modid),        INDEX modpri_fk2 (priid)    )    ENGINE=InnoDB DEFAULT CHARSET=utf8;CREATE TABLE    rolemodpri    (        rolemodpri INT DEFAULT '0' NOT NULL,        roleid INT,        modpriid INT,        PRIMARY KEY (rolemodpri),        CONSTRAINT rolemodpri_fk1 FOREIGN KEY (roleid) REFERENCES role (roleid) ,        CONSTRAINT rolemodpri_fk2 FOREIGN KEY (modpriid) REFERENCES modpri (modpriid),        INDEX rolemodpri_fk1 (roleid),        INDEX rolemodpri_fk2 (modpriid)    )    ENGINE=InnoDB DEFAULT CHARSET=utf8;


Design Drawing:


Attachment:

Http://download.csdn.net/detail/linzhichao12345/7741975


How to use WEB development as a webpage for permission management

The database is designed with a user role. Different permissions go through different sessions and different contents are displayed based on different sessions.

Database Design Issues with user permissions?

In the simplest case, all the permissions are detailed in a table, as shown below:
USER (UID, A_ADD, A_UPD, A_DEL, B _ADD, B _UPD, B _DEL, C_ADD, C_UPD, C_DEL, D_ADD, D_UPD, D_DEL, E_ADD, E_UPD, E_DEL)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.