Back to index

lightning-sunbird  0.9+nobinonly
nsIPrincipal.idl
Go to the documentation of this file.
00001 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
00002 /* ***** BEGIN LICENSE BLOCK *****
00003  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
00004  *
00005  * The contents of this file are subject to the Mozilla Public License Version
00006  * 1.1 (the "License"); you may not use this file except in compliance with
00007  * the License. You may obtain a copy of the License at
00008  * http://www.mozilla.org/MPL/
00009  *
00010  * Software distributed under the License is distributed on an "AS IS" basis,
00011  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
00012  * for the specific language governing rights and limitations under the
00013  * License.
00014  *
00015  * The Original Code is mozilla.org code.
00016  *
00017  * The Initial Developer of the Original Code is
00018  * Netscape Communications Corporation.
00019  * Portions created by the Initial Developer are Copyright (C) 1999-2003
00020  * the Initial Developer. All Rights Reserved.
00021  *
00022  * Contributor(s):
00023  *   Mitchell Stoltz <mstoltz@netscape.com>
00024  *   Christopher A. Aillon <christopher@aillon.com>
00025  *
00026  * Alternatively, the contents of this file may be used under the terms of
00027  * either of the GNU General Public License Version 2 or later (the "GPL"),
00028  * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
00029  * in which case the provisions of the GPL or the LGPL are applicable instead
00030  * of those above. If you wish to allow use of your version of this file only
00031  * under the terms of either the GPL or the LGPL, and not to allow others to
00032  * use your version of this file under the terms of the MPL, indicate your
00033  * decision by deleting the provisions above and replace them with the notice
00034  * and other provisions required by the GPL or the LGPL. If you do not delete
00035  * the provisions above, a recipient may use your version of this file under
00036  * the terms of any one of the MPL, the GPL or the LGPL.
00037  *
00038  * ***** END LICENSE BLOCK ***** */
00039 
00040 /* Defines the abstract interface for a principal. */
00041 
00042 #include "nsISerializable.idl"
00043 
00044 %{C++
00045 struct JSContext;
00046 struct JSPrincipals;
00047 %}
00048 
00049 interface nsIURI;
00050 
00051 [ptr] native JSContext(JSContext);
00052 [ptr] native JSPrincipals(JSPrincipals);
00053 
00054 [uuid(fb9ddeb9-26f9-46b8-85d5-3978aaee05aa)]
00055 interface nsIPrincipal : nsISerializable
00056 {
00062     const short ENABLE_DENIED                = 1;
00063     const short ENABLE_UNKNOWN               = 2;
00064     const short ENABLE_WITH_USER_PERMISSION  = 3;
00065     const short ENABLE_GRANTED               = 4;
00066 
00076     void getPreferences(out string prefBranch, out string id,
00077                         out string subjectName,
00078                         out string grantedList, out string deniedList);
00079 
00085     boolean equals(in nsIPrincipal other);
00086 
00090     readonly attribute unsigned long hashValue;
00091 
00096     JSPrincipals getJSPrincipals(in JSContext cx);
00097 
00101     // XXXcaa should this be here?  The script security manager is the only
00102     // thing that should care about this.  Wouldn't storing this data in one
00103     // of the hashtables in nsScriptSecurityManager be better?
00104     // XXXbz why is this writable?  Who should have write access to this?  What
00105     // happens if this principal is in our hashtable and we pass it out of the
00106     // security manager and someone writes to this field?  Especially if they
00107     // write garbage?  If we need to give someone other than the security
00108     // manager a way to set this (which I question, since it can increase the
00109     // permissions of a page) it should be a |void clearSecurityPolicy()|
00110     // method.
00111     attribute voidPtr securityPolicy;
00112 
00113     // XXXcaa probably should be turned into {get|set}CapabilityFlags
00114     // XXXbz again, what if this lives in our hashtable and someone
00115     // messes with it?  Is that OK?
00116     short canEnableCapability(in string capability);
00117     void setCanEnableCapability(in string capability, in short canEnable);
00118     boolean isCapabilityEnabled(in string capability, in voidPtr annotation);
00119     void enableCapability(in string capability, inout voidPtr annotation);
00120     void revertCapability(in string capability, inout voidPtr annotation);
00121     void disableCapability(in string capability, inout voidPtr annotation);
00122 
00127     readonly attribute nsIURI URI;
00128 
00134     attribute nsIURI domain;
00135 
00141     // XXXcaa this should probably be turned into an nsIURI.
00142     // The system principal's origin should be some caps namespace
00143     // with a chrome URI.  All of chrome should probably be the same.
00144     readonly attribute string origin;
00145 
00149     readonly attribute boolean hasCertificate;
00150 
00155     // XXXcaa kaie says this may not be unique.  We should probably
00156     // consider using something else for this....
00157     readonly attribute AUTF8String fingerprint;
00158 
00168     readonly attribute AUTF8String prettyName;
00169 
00188     boolean subsumes(in nsIPrincipal other);
00189 
00199     readonly attribute AUTF8String subjectName;
00200 
00205     readonly attribute nsISupports certificate;
00206 };