国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 開發(fā) > JS > 正文

基于邏輯運算的簡單權(quán)限系統(tǒng)(實現(xiàn)) JS 版

2024-09-06 12:42:55
字體:
供稿:網(wǎng)友
作者: slightboy, 時間: 2006-10-17
此篇為 JS 實現(xiàn)版本, 以前作已交待原理 故不在此多做解釋
如需原理介紹 請查看 VBS 版.
var PermissionType =
{
    Read : 1,
    Write : 2,
    Delete : 4
}
function PermissionSetComponent(value)
{
    this.Value = value;
    this.getRead = function()
    {
        return this.getValue(PermissionType.Read);
    }
    this.setRead = function(value)
    {
        this.setValue(PermissionType.Read, value);
    }
    this.Read = function()
    {
        if (arguments.length > 0)
            this.setValue(PermissionType.Read, arguments[0]);
        else
            return this.getValue(PermissionType.Read);
    }
    this.Write = function()
    {
        if (arguments.length > 0)
            this.setValue(PermissionType.Write, arguments[0]);
        else
            return this.getValue(PermissionType.Write);
    }
    this.Delete = function()
    {
        if (arguments.length > 0)
            this.setValue(PermissionType.Delete, arguments[0]);
        else
            return this.getValue(PermissionType.Delete);
    }
    this.getValue = function(permissionType)
    {
        return (this.Value & permissionType) == permissionType;
    }
    this.setValue = function(permissionType, value)
    {
        if (value)
            this.Value |= permissionType;
發(fā)表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發(fā)表
主站蜘蛛池模板: 阜康市| 揭西县| 乌兰县| 华阴市| 四子王旗| 海伦市| 麻江县| 大洼县| 武威市| 灵山县| 巫山县| 嘉义市| 和政县| 垦利县| 石渠县| 五原县| 砀山县| 内乡县| 开远市| 松溪县| 休宁县| 冕宁县| 衡山县| 高唐县| 长岛县| 吉首市| 长兴县| 罗源县| 泾阳县| 南安市| 股票| 博兴县| 晋中市| 长顺县| 怀远县| 怀集县| 资中县| 梁平县| 翁源县| 稷山县| 称多县|